Skip to content

[https://nvbugs/6482576][fix] Fall back to disagg_request_id in Python NIXL decode receiver#16720

Merged
Shixiaowei02 merged 1 commit into
NVIDIA:mainfrom
Shixiaowei02:fix/nvbug-6482576-disagg-ctx-request-id-fallback
Jul 24, 2026
Merged

[https://nvbugs/6482576][fix] Fall back to disagg_request_id in Python NIXL decode receiver#16720
Shixiaowei02 merged 1 commit into
NVIDIA:mainfrom
Shixiaowei02:fix/nvbug-6482576-disagg-ctx-request-id-fallback

Conversation

@Shixiaowei02

@Shixiaowei02 Shixiaowei02 commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Description

This pull request improves the handling of request IDs in the disaggregated receiver logic and adds new tests to ensure correct fallback behavior when ctx_request_id is missing. The changes address a known bug (nvbugs/6482576) where the receiver could crash if ctx_request_id is None, by falling back to disagg_request_id instead. Additionally, tests are updated and expanded to cover these scenarios.

Bug fix and fallback logic:

  • Modified _build_recv_req_info in transfer.py to fall back to disagg_request_id when ctx_request_id is None, preventing receiver crashes on certain requests. An assertion ensures at least one ID is present.

Test improvements:

  • Updated the test module docstring and added new tests in test_request_id.py to verify the receiver's fallback logic and assertion for missing IDs. [1] [2]

These changes make the receiver more robust and ensure test coverage for the new behavior.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

Dev Engineer Review

  • Fixed Receiver._build_recv_req_info sender request-id handling for disaggregated (NIXL decode) receiver flows by preferring task._params.ctx_request_id and falling back to task._params.disagg_request_id when ctx_request_id is None (nvbugs/6482576).
  • Replaced the prior ctx_request_id non-None assertion with explicit error handling: if both ctx_request_id and disagg_request_id are None, the code now raises ValueError to prevent None from reaching RecvReqInfo.sender_req_id/the wire (still keeps task._unique_rid non-None assertion).
  • No public API/config changes were made; no updates were made to test-list/config/waive files.

QA Engineer Review

  • Test changes in tests/unittest/disaggregated/test_request_id.py:
    • Added tests:
      • test_build_recv_req_info_prefers_ctx_request_id
      • test_build_recv_req_info_falls_back_to_disagg_request_id
      • test_build_recv_req_info_both_ids_none_raises
    • Added local helpers to construct a minimal receive-task and exercise Receiver._build_recv_req_info as an unbound method with a mocked registrar.
  • Integration/CI coverage lists (tests/integration/test_lists/, test-db/, qa/, waives.txt) were not updated since this is unit-test coverage only.
  • Verdict: needs follow-up.

@Shixiaowei02
Shixiaowei02 requested a review from a team as a code owner July 22, 2026 09:09
@Shixiaowei02
Shixiaowei02 requested review from bo-nv and nv-xtf July 22, 2026 09:09
@Shixiaowei02
Shixiaowei02 force-pushed the fix/nvbug-6482576-disagg-ctx-request-id-fallback branch from f297be0 to 47a2999 Compare July 22, 2026 09:09
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4c4b5849-b9d7-4512-a708-2c5be9947cac

📥 Commits

Reviewing files that changed from the base of the PR and between b2f8d78 and 346f26d.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/disaggregation/native/transfer.py
  • tests/unittest/disaggregated/test_request_id.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tensorrt_llm/_torch/disaggregation/native/transfer.py

Walkthrough

Changes

Disaggregated request ID handling

Layer / File(s) Summary
Request ID selection and validation
tensorrt_llm/_torch/disaggregation/native/transfer.py, tests/unittest/disaggregated/test_request_id.py
Receiver request construction prefers ctx_request_id, falls back to disagg_request_id, raises ValueError when both are missing, and tests all three cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: bo-nv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the bug fix and clearly summarizes the main change with the NVBugs reference and fix type.
Description check ✅ Passed The description explains the problem and solution and notes test additions, but the required Test Coverage section is left blank.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Shixiaowei02
Shixiaowei02 requested a review from chuangz0 July 22, 2026 09:10
@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tensorrt_llm/_torch/disaggregation/native/transfer.py`:
- Around line 1498-1506: Replace the assert guarding sender_req_id in the task
request-ID fallback flow with an explicit ValueError when both
task._params.ctx_request_id and task._params.disagg_request_id are missing, so
validation remains active under optimization. Add a regression test covering the
both-IDs-missing case and verify that ValueError is raised.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2064cd02-f1c2-4b25-9a0c-651990db4cb8

📥 Commits

Reviewing files that changed from the base of the PR and between 9095cc1 and 47a2999.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/disaggregation/native/transfer.py
  • tests/unittest/disaggregated/test_request_id.py

Comment thread tensorrt_llm/_torch/disaggregation/native/transfer.py Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60942 [ run ] triggered by Bot. Commit: 47a2999 Link to invocation

@Shixiaowei02
Shixiaowei02 force-pushed the fix/nvbug-6482576-disagg-ctx-request-id-fallback branch from 47a2999 to b8cb01e Compare July 22, 2026 09:25
@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@Shixiaowei02
Shixiaowei02 force-pushed the fix/nvbug-6482576-disagg-ctx-request-id-fallback branch from b8cb01e to 23958d5 Compare July 22, 2026 09:31
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60947 [ run ] triggered by Bot. Commit: 23958d5 Link to invocation

@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60942 [ run ] completed with state ABORTED. Commit: 47a2999

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60954 [ run ] triggered by Bot. Commit: 23958d5 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60947 [ run ] completed with state ABORTED. Commit: 23958d5

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60954 [ run ] completed with state SUCCESS. Commit: 23958d5
/LLM/main/L0_MergeRequest_PR pipeline #49217 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Shixiaowei02
Shixiaowei02 force-pushed the fix/nvbug-6482576-disagg-ctx-request-id-fallback branch from 23958d5 to b2f8d78 Compare July 22, 2026 11:04
@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60971 [ run ] triggered by Bot. Commit: b2f8d78 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60971 [ run ] completed with state FAILURE. Commit: b2f8d78
/LLM/main/L0_MergeRequest_PR pipeline #49233 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

…n NIXL decode receiver

In disaggregated serving with cache_transceiver_config.backend=NIXL and
transceiver_runtime=PYTHON, a generation request can reach the decode worker
with disagg_request_id populated but ctx_request_id None.
Receiver._build_recv_req_info() asserted ctx_request_id is not None, which
crashed that decode rank's event loop and left peer ranks hanging in MPI
collectives.

sender_req_id keys the ctx TxSession but is never read back by the sender's
_respond_with_kv (which keys on unique_rid), so fall back to disagg_request_id
when ctx_request_id is None. Raise ValueError (not assert, so it survives
python -O) if both ids are None, so a None id never reaches RecvReqInfo.

Add unit tests in test_request_id.py covering the ctx-preferred, disagg
fallback, and both-None cases.

Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
@Shixiaowei02
Shixiaowei02 force-pushed the fix/nvbug-6482576-disagg-ctx-request-id-fallback branch from b2f8d78 to 346f26d Compare July 23, 2026 02:19
@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61155 [ run ] triggered by Bot. Commit: 346f26d Link to invocation

@nv-xtf nv-xtf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious — is ctx_request_id being gradually phased out in favor of disagg_request_id?

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61155 [ run ] completed with state SUCCESS. Commit: 346f26d
/LLM/main/L0_MergeRequest_PR pipeline #49404 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

Just curious — is ctx_request_id being gradually phased out in favor of disagg_request_id?

Yes, we'd like to keep only a single ID, as that's the cleanest design. The ctx_request_id is a legacy artifact from the pre-dis-agg days, so it's not something we can remove right now. @nv-xtf

@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61262 [ run ] triggered by Bot. Commit: 346f26d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61262 [ run ] completed with state FAILURE. Commit: 346f26d
/LLM/main/L0_MergeRequest_PR pipeline #49498 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@pcastonguay

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61452 [ run ] triggered by Bot. Commit: 346f26d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61452 [ run ] completed with state FAILURE. Commit: 346f26d
/LLM/main/L0_MergeRequest_PR pipeline #49673 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot skip --comment "Related tests have passed."

@Shixiaowei02
Shixiaowei02 enabled auto-merge (squash) July 24, 2026 07:39
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61534 [ skip ] triggered by Bot. Commit: 346f26d Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61534 [ skip ] completed with state SUCCESS. Commit: 346f26d
Skipping testing for commit 346f26d

Link to invocation

@Shixiaowei02
Shixiaowei02 merged commit 75b39d4 into NVIDIA:main Jul 24, 2026
11 checks passed
yuanjingx87 pushed a commit to yuanjingx87/TensorRT-LLM that referenced this pull request Jul 26, 2026
…n NIXL decode receiver (NVIDIA#16720)

Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants